<template>
    <ol>
        <li v-for="(item, index) in list" :key="index" @click="judgeItem(index)">{{ item }}</li>
    </ol>
</template>
<script setup>
import { defineEmits, defineProps } from 'vue';
let emit = defineEmits(['handleJudge', 'handleDelete'])
let judgeItem = function (index) {
    if (!props.listType) {
        emit("handleJudge", index);
    } else {
        emit("handleDelete", index);
    }
}

let props = defineProps({
    list: {
        type: Array,
        required: true,
    },
    listType: {
        type: Boolean,
        default: false,
    }
})
</script>


<style scoped>
ol {
    margin-top: 20px;
}

ol li {
    cursor: pointer;
}
</style>